package video;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.hyt.it.ogt.download.Application;
import com.hyt.it.ogt.download.config.ConfigManager;
import com.hyt.it.ogt.download.entity.Video;
import com.hyt.loginfo.model.UserPermissionQueryVo;
import com.hyt.loginfo.service.IUaUserExtService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RunWith(SpringRunner.class)
@Slf4j
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class VideoDemo {
    @Resource
    private IUaUserExtService iUaUserExtService;
    @Resource
    private ConfigManager configManager;

    @Test
    public void b() {
        UserPermissionQueryVo p = iUaUserExtService.queryUserOfficeIdByPermission("admin", "111", configManager.getVideoPermission());
        log.debug(JSON.toJSONString(p));
    }

    private static List<Video> l() {
        List<Video> list = new ArrayList<>();
        list.add(Video.builder().fileId("1211311")
                .fileUrl("http://1500005027.vod2.myqcloud.com/6c9a2ef6vodcq1500005027/e5afcc58387702298640867042/f0.mp4")
                .fileSize(4773119L).startTime(DateUtil.parseLocalDateTime("2022-04-04 15:38:54"))
                .endTime(DateUtil.parseLocalDateTime("2022-04-04 15:39:54")).build());
        list.add(Video.builder().fileId("1211311")
                .fileUrl("http://1500005027.vod2.myqcloud.com/6c9a2ef6vodcq1500005027/ff243e02387702298542318879/f0.mp4")
                .fileSize(7616080L).startTime(DateUtil.parseLocalDateTime("2022-04-02 14:14:21"))
                .endTime(DateUtil.parseLocalDateTime("2022-04-02 14:15:23")).build());
        return list;
    }
}
